﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace Brain.General
{
    public class DefaultGamerCamera : IGamerCamera
    {
        public CameraType Type { get; set; }

        public bool UseCameraSmoothing
        {
            get { return Parent.Options.UseCameraSmoothing; }
            set { Parent.Options.UseCameraSmoothing = value; }
        }

        public float NearPlane
        {
            get { return Parent.Options.NearPlane; }
            set { Parent.Options.NearPlane = value; }
        }

        public float FarPlane
        {
            get { return Parent.Options.FarPlane; }
            set { Parent.Options.FarPlane = value; }
        }

        public Matrix View { get; set; }

        public Matrix Projection { get; set; }

        public Vector3 Position { get; set; }

        public Vector3 Target { get; set; }

        public Vector3 Up { get; set; }

        public BoundingFrustum Frustum { get; set; }

        public string Name { get; set; }
        
        public bool ShouldDraw { get; set; }

        public IGamerController Parent { get; protected set; }

        public Matrix RotationMatrix { get; set; }

        public void Initialize(IGamerController parent)
        {
            this.Parent = parent;
        }

        public void Draw()
        {
            Projection = Matrix.CreatePerspectiveFieldOfView(this.Parent.Options.FOV, this.Parent.Options.AspectRatio, this.NearPlane, this.FarPlane);
            View = Matrix.CreateLookAt(this.Position, this.Target, this.Up);
        }

        public Vector3 RotationRadians { get; set; }
    }
}
